#!/bin/bash

# Creates a new file in the session directory, named with a jam-timestamp and ready
# to start livecoding.  It uses the EDITOR environment variable to find an editor
# to use.

echo "Project Overtone initializing..."

BIG_JAM=jam-`date +%H%M-%d-%b-%y`
JAM=`echo $BIG_JAM | tr "[:upper:]" "[:lower:]"`
JAM_FILE=`echo "session/${JAM}.clj" | sed 's/-/_/g'`

echo "JAM: $JAM"
echo "JAM_FILE: $JAM_FILE"

echo -e "(ns $JAM\n  (:use overtone))\n" >> $JAM_FILE

./script/tune-up

$EDITOR $JAM_FILE
